package com.k.kc.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author kivil
 */
public class ArrayUtils {

    /**
     * 数组类型转换
     * @param source Object array
     * @return  String array
     */
    public static String[] convertStringArray(Object[] source){
        String[] dest = new String[source.length];
        System.arraycopy(source, 0, dest, 0, source.length);
        String[] stringArray = Arrays.copyOf(source,source.length, String[].class);
        return dest;
    }

    public static String[] convert(List<String> list){
        return list.stream().map(a->a).toArray(String[]::new);
    }


    public static <T> T[] toArray(List<T> list,T[] a){
        return list.toArray(a);
    }
    public static void main(String[] args) {
        String[] strArr = new String[0];
        System.out.println(strArr.length);
        for(String itm:strArr){
            System.out.println("itm:"+itm);
        }
    }

}
